package epin.fujiajun.sort.primary;

import epin.fujiajun.data.Array;
import epin.fujiajun.data.array.Number;
import epin.fujiajun.sort.ArraySortBase;

/**
 * Created by DELL on 2017/8/31.
 */
public class Bubble extends ArraySortBase {

    @Override
    public void sort(Array[] a) {
        int N = a.length;

        for (int i = 0;i < N-1;i++){
            for (int j = 0;j < N-1-i;j++){
                if (less(a[j+1], a[j])){
                    exChange(a, j, j+1);
                }
            }
        }
    }

    public static void main(String[] args){
        new Bubble().main(Number.createArray(100, 1000));
    }
}
